<?php

namespace App\Models\Permission;

use App\Http\Traits\QueryHelperTrait;
use App\Models\Auth\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Role extends Model {

    use SoftDeletes, QueryHelperTrait;

    protected $fillable = [
        'name',
    ];

    public function permissions() {
        return $this->belongsToMany(Permission::class, RolePermission::class);
    }

    public function users() {
        return $this->hasMany(User::class);
    }

    public function rolePermissions() {
        return $this->hasMany(RolePermission::class);
    }
}
